//Packages
// cap ssc install outtable
// cap ssc instal shp2dta
// cap ssc install spmap
// cap net install gr0070.pkg

clear all
set more off
capture log close
set scheme plotplainblind, perm

*************************************************************

global des "G:\Mi unidad\1semestre\1 Fertility\IVE"
global data "$des/Data"
	global raw "$data/Raw"
global res "$des/Resultados"
	global graf "$res/Graficos"
	global tab "$res/Tablas"
	

***********************************************************************
***********************************************************************

// IVE
import excel "$raw\IVE_2018_2019_2020_ENERO_JUNIO_2021.xlsx", firstrow clear  case(lower)

// Date
rename año year 
drop mes
gen month = month(fecha_concurrencia)

gen date_n = month
replace date_n = date_n + 0  if year == 2018
replace date_n = date_n + 12 if year == 2019
replace date_n = date_n + 24 if year == 2020
replace date_n = date_n + 36 if year == 2021

egen quarter = cut(date_n), at(1,4,7,10,13,16,19,22,25,28,31,34,37,40,43,46)
cap label drop quarter
label define quarter 1 "2018 q1" 4 "q2" 7 "q3" 10 "q4" ///
13 "2019 q1" 16 "q2" 19 "q3" 22 "q4" ///
25 "2020 q1" 28 "q2" 31 "q3" 34 "q4" ///
37 "2021 q1" 40 "q2" 43 "q3" 46 "q4" 
label val quarter quarter


// Type of Request
gen causal_1 = (causal == "Causal 1")
gen causal_2 = (causal == "Causal 2")
gen causal_3 = (causal == "Causal 3")
label var causal_1 "Woman at Risk"
label var causal_2 "No Fetal Viability"
label var causal_3 "Pregnancy by Rape"

gen causal_num = .
replace causal_num = 1 if causal == "Causal 1"
replace causal_num = 2 if causal == "Causal 2"
replace causal_num = 3 if causal == "Causal 3"
label define causal_num 1 "Woman at Risk" 2 "No Fetal Viability" 3 "Pregnancy by Rape"
label val causal_num causal_num

// Decision after consultation
encode hito2_decision_mujer_ive, gen(decision)
gen decision_cont = 1 if decision == 1
replace decision_cont = 0 if decision == 2

// Gestational weeks
rename hito1_edad_gestacional_semanas gest_weeks
*rename hito3_semanas_g_evacua gest_weeks

// Type of health care coverage
replace prevision_salud = "SIN PREVISION" if prevision_salud == "SIN PREVISIÓN" | prevision_salud == "NINGUNA"
replace prevision_salud = "CAPREDENA DIPRECA FFAA" if prevision_salud == "CAPREDENA" | prevision_salud == "DIPRECA" | prevision_salud == "SISTEMA PREVISIONAL DE LAS FFAA" 
replace prevision_salud = "" if prevision_salud == "SIN INFORMACIÓN" | prevision_salud == "DESCONOCIDO" | prevision_salud == "SISA"
encode prevision_salud, gen(prevision)

// Municipalities
rename comuna_residencia comuna_nombre
replace comuna_nombre = "AYSEN" if comuna_nombre == "AISEN"
replace comuna_nombre = "CONCON" if comuna_nombre == "CON CON"
replace comuna_nombre = "COYHAIQUE" if comuna_nombre == "COIHAIQUE"
gen aux = substr(comuna_nombre,1,5)
replace comuna_nombre = "PEDRO AGUIRRE CERDA" if aux == "PEDRO"
drop aux
replace comuna_nombre = "SIN INFORMACION" if comuna_nombre == "SIN INFORMACIÓN"

tempfile ive 
save `ive'

use "$raw/comunas_nombres.dta", replace
keep comuna_nombre comuna
gen aux1 = upper(comuna_nombre)
drop comuna_nombre
rename aux1 comuna_nombre
replace comuna_nombre=subinstr(comuna_nombre,"ñ","Ñ",.)

merge 1:m comuna_nombre using `ive' 
drop if _merge == 1 //no cases
drop _merge

// Region
gen codregion = floor(comuna/1000)
replace codregion = 2 if region_residencia == "REGION DE ANTOFAGASTA"


save "$data/IVE.dta", replace

***********************************************************************

// POPULATION AT FERTILE AGE
import excel "$raw\estimaciones-y-proyecciones-2002-2035-comunas.xlsx", sheet("Est. y Proy. de Pob. Comunal") firstrow case(lower) clear 

keep if sexo == 2

keep comuna nombrecomuna edad poblacion2018 poblacion2019 poblacion2020 poblacion2021
rename edad edad_mujer
keep if inrange(edad_mujer,15,49)

reshape long poblacion , j(year) i(edad_mujer comuna nombrecomuna)
collapse (sum) poblacion, by(*comuna year)
rename poblacion poblacion_comuna_edfertil 

save "$data/Population.dta", replace

***********************************************************************

// MUNICIPALITIES AVERAGE INCOME 
import excel "$raw\income.xlsx", sheet("income") firstrow case(lower) clear 
rename (comuna ingresopercápmens) (nombrecomuna ingresopercapmens)
replace nombrecomuna = "Aysén" if nombrecomuna == "Aisén"
replace nombrecomuna = "Coyhaique" if nombrecomuna == "Coihaique"
replace nombrecomuna = "Los Álamos" if nombrecomuna == "Los Alamos"
replace nombrecomuna = "Pitrufquen" if nombrecomuna == "Pitrufquén"

save "$data/Income.dta", replace

***********************************************************************

// CRIMINAL COMPLAINTS OF SEXUAL CRIMES
import excel "$raw\Denuncias\Region\denuncias_abusos_sexuales_frecuencia_v2.xlsx", firstrow clear 
 drop in 1
 gen cir_sena = _n
rename y* n_denuncias*

save "$data/Denuncias.dta", replace

***********************************************************************

// CONSCENTIOUS OBJECTORS BY REQUEST
tempfile s
import excel "$raw/ObjetoresConciencia/Funcionarios objetores de conciencia por Servicio de Salud a septiembre 2019 - Ministerio de Salud - Gobierno de Chile v2.xlsx", sheet("medicos") firstrow case(lower) clear
rename * *_medicos
rename serviciodesalud serviciodesalud
keep if serviciodesalud == "Total"
save `s', replace

foreach m in anestecistas no_medicos paramedicos {
    di "`m'"
    import excel "$raw/ObjetoresConciencia/Funcionarios objetores de conciencia por Servicio de Salud a septiembre 2019 - Ministerio de Salud - Gobierno de Chile v2.xlsx", sheet("`m'") firstrow case(lower) clear
	rename * *_`m'
	rename serviciodesalud serviciodesalud
	keep if serviciodesalud == "Total"
	merge 1:1 serviciodesalud using `s'
	drop _merge*
	save `s', replace
}


foreach v of varlist contratados_medicos contratados_no_medicos contratados_paramedicos{
	replace `v' = `v'*1000
}

egen contratados_total = rowtotal(contratados*)
egen causal1_total = rowtotal(causal1*)
egen causal2_total = rowtotal(causal2*)
egen causal3_total = rowtotal(causal3*)

forval c = 1/3{
	gen perc_`c'_Paramedics = causal`c'_paramedicos/contratados_paramedicos*100
	gen perc_`c'_Doctors = causal`c'_medicos/contratados_medicos*100
	gen perc_`c'_Anesthetists = causal`c'_anestecistas/contratados_anestecistas*100
	gen perc_`c'_NonDoctors = causal`c'_no_medicos/contratados_no_medicos*100
	gen perc_`c'_Average = causal`c'_total/contratados_total*100
}

drop causal*

reshape long perc_1_ perc_2_ perc_3_ , i(serviciodesalud) j(funcionario, string)

gen funcionario2 = .
local j = 1
foreach m in Doctors Anesthetists NonDoctors Paramedics Average{
	replace funcionario2 = `j' if funcionario == "`m'"
	local j = `j'+1
}
label define funcionario2 1 "Doctors" 2 "Anesthetists" 3 "Non-Doctors" 4 "Paramedics" 5 "Average", modify
label val funcionario2 funcionario2

save "$data/Conscious_Objectors.dta", replace

***********************************************************************

// CONSCENTIOUS OBJECTORS BY REGION
tempfile s
import excel "$raw/ObjetoresConciencia/Funcionarios objetores de conciencia por Servicio de Salud a septiembre 2019 - Ministerio de Salud - Gobierno de Chile v2.xlsx", sheet("medicos") firstrow case(lower) clear
rename * *_medicos
rename serviciodesalud serviciodesalud
drop if serviciodesalud == ""
save `s', replace

foreach m in anestecistas no_medicos paramedicos {
    di "`m'"
    import excel "$raw/ObjetoresConciencia/Funcionarios objetores de conciencia por Servicio de Salud a septiembre 2019 - Ministerio de Salud - Gobierno de Chile v2.xlsx", sheet("`m'") firstrow case(lower) clear
	rename * *_`m'
	rename serviciodesalud serviciodesalud
	drop if serviciodesalud == ""
	merge 1:1 serviciodesalud using `s'
	drop _merge*
	save `s', replace
}

drop if serviciodesalud == "Total"

gen region_orden     = 1  if serviciodesalud == "Arica"
replace region_orden = 2  if serviciodesalud == "Iquique"
replace region_orden = 3  if serviciodesalud == "Antofagasta"
replace region_orden = 4  if serviciodesalud == "Atacama"
replace region_orden = 5  if serviciodesalud == "Coquimbo"
replace region_orden = 6  if serviciodesalud == "Valparaíso"
replace region_orden = 6  if serviciodesalud == "Viña de Mar"
replace region_orden = 6  if serviciodesalud == "Aconcagua"
replace region_orden = 7  if serviciodesalud == "Metro Norte"
replace region_orden = 7  if serviciodesalud == "Metro Occidente"
replace region_orden = 7  if serviciodesalud == "Metro Central"
replace region_orden = 7  if serviciodesalud == "Metro Oriente"
replace region_orden = 7  if serviciodesalud == "Metro Sur"
replace region_orden = 7  if serviciodesalud == "Metro Sur Oriente"
replace region_orden = 8  if serviciodesalud == "O'Higgins"
replace region_orden = 8  if region_orden == . //No me lee O'Higgins.
replace region_orden = 9 if serviciodesalud == "Maule"
replace region_orden = 10 if serviciodesalud == "Ñuble"
replace region_orden = 11 if serviciodesalud == "Concepción"
replace region_orden = 11 if serviciodesalud == "Talcahuano"
replace region_orden = 11 if serviciodesalud == "Biobío"
replace region_orden = 11 if serviciodesalud == "Arauco"
replace region_orden = 12 if serviciodesalud == "Araucanía Norte"
replace region_orden = 12 if serviciodesalud == "Araucanía Sur"
replace region_orden = 13 if serviciodesalud == "Valdivia"
replace region_orden = 14 if serviciodesalud == "Osorno"
replace region_orden = 14 if serviciodesalud == "Del Reloncaví"
replace region_orden = 14 if serviciodesalud == "Chiloé"
replace region_orden = 15 if serviciodesalud == "Aysén"
replace region_orden = 16 if serviciodesalud == "Magallanes"

label define region_orden 1 "Arica" 2 "Iquique" 3 "Antofagasta" 4 "Atacama" 5 "Coquimbo" 6 "Valparaíso" 7 "Metropolitana" 8 "O'Higgins" 9 "Maule" 10 "Ñuble" 11 "Biobío" 12 "La Araucanía" 13 "Los Ríos" 14 "Los Lagos" 15 "Aysén" 16 "Magallanes"
label values region_orden region_orden
order region_orden
sort region_orden

collapse (sum) causal* contratados*, by(region_orden)

egen contratados = rowtotal(contratados*)

egen objetores_c1 = rowtotal(causal1*)
egen objetores_c2 = rowtotal(causal2*)
egen objetores_c3 = rowtotal(causal3*)

gen porc_objetores_c1 = objetores_c1/contratados*100
gen porc_objetores_c2 = objetores_c2/contratados*100
gen porc_objetores_c3 = objetores_c3/contratados*100

foreach m in medicos anestecistas no_medicos paramedicos{
    forval c = 1/3{
	    gen porc_`m'_c`c' = causal`c'_`m'/contratados_`m'*100
	}
}


save "$data/Conscious_Objectors_Region.dta", replace

stp

***********************************************************************
***********************************************************************


// FIG 1
// Number of Abortion Requests by Cause – 2018­2021

// Data
use "$data/IVE.dta", clear

collapse (sum) causal_1 causal_2 causal_3 , by(quarter)

// Fig 1
twoway (connected causal_1 quarter, sort) (connected causal_2 quarter, sort) (connected causal_3 quarter, sort) ///
,xlabel(1(3)43) xlabel(, valuelabel angle(45)) xtitle("Quarter") ///
ytitle("Number of requests") ///
legend(order(1 "1: Woman at Risk" 2 "2: No Fetal Viability" 3 "3: Pregnancy by Rape")) 

*graph export "$graf/casos_trimestre_1.pdf", as(pdf) replace



***********************************************************************
***********************************************************************

// TAB 1
// Interruption Decision After Initial Consultation by Cause

// Data
use "$data/IVE.dta", clear

// Tab 1
tab causal decision_cont, row matcell(A)
mat B = A, A[1..3,1]+A[1..3,2]
mat B = B\ B[1,1]+B[2,1]+B[3,1],B[1,2]+B[2,2]+B[3,2],B[1,3]+B[2,3]+B[3,3]
mat C = B
forval m = 1/4{
    mat C[`m',1] = C[`m',1]/C[`m',3]*100
    mat C[`m',2] = C[`m',2]/C[`m',3]*100
    mat C[`m',3] = C[`m',3]/C[`m',3]*100
}

forval y= 18/21{
    local y2 = 2000 + `y'
    tab causal decision_cont if year == `y2', row matcell(A`y')
	mat B`y' = A`y', A`y'[1..3,1]+A`y'[1..3,2]
	mat C`y' = B`y'
	forval m = 1/3{
    mat C`y'[`m',1] = C`y'[`m',1]/C`y'[`m',3]*100
    mat C`y'[`m',2] = C`y'[`m',2]/C`y'[`m',3]*100
    mat C`y'[`m',3] = C`y'[`m',3]/C`y'[`m',3]*100
}
mat li B`y'
mat li C`y'
}

mat T = C,B\C18,B18\C19,B19\C20,B20\C21,B21
mat colnames T = "Inter_porc" "Cont_porc" "total" "Inter_N" "Cont_N" "total"
mat rownames T = "Women_at_Risk" "Fetal_Inviability" "Pregnancy_by_Rape" "Total" "Women_at_Risk18" "Fetal_Inviability" "Pregnancy_by_Rape" "Women_at_Risk19" "Fetal_Inviability" "Pregnancy_by_Rape"  "Women_at_Risk20" "Fetal_Inviability" "Pregnancy_by_Rape" "Women_at_Risk21" "Fetal_Inviability" "Pregnancy_by_Rape"

mat li T

forval c = 1/3{
	gen difference_`c' = hito3_semanas_g_evacua - gest_weeks if causal_num == `c'
	replace difference_`c' = . if difference_`c' < 0
	sum difference_`c'
}



*outtable using "$tab/decision_causal_year", mat(T) replace nobox center format(%3.0f %3.0f %3.0f %3.0f %3.0f %3.0f)

***********************************************************************


// FIG 2
// Characteristics of Requesting Women – Age and Gestational Stage

// Data
use "$data/IVE.dta", clear

#d;
tempvar count_mujer count_gest ;
bys causal_num edad_mujer: egen `count_mujer' = count(causal_num);
bys causal_num gest_weeks: egen `count_gest' = count(causal_num);

forval c = 1/3{;
tw (bar `count_mujer' edad_mujer if causal_num == `c', sort fcolor(gs5) lcolor(gs5) barwidth(0.65)),
/*title("Causal `c'")*/ xtitle(" ") ytitle(" ")
xlabel(10(2)50) ylabel(0(20)80) ;
/*graph export "$graf/barra_edad_mujer_causal`c'.pdf", as(pdf) replace */
;
tw (bar `count_gest' gest_weeks if causal_num == `c', sort fcolor(gs5) lcolor(gs5) barwidth(0.65)),
/*title("Causal `c'")*/ xtitle(" ") ytitle(" ")
xlabel(0(2)42) ylabel(0(20)120) ;
/*graph export "$graf/barra_edad_gest_causal`c'.pdf", as(pdf) replace */
;
};

#d cr

bys causal_num: sum edad_mujer
bys causal_num: sum gest_weeks, d


***********************************************************************

// TAB 2
// Health insurance according to type of request

// Data
use "$data/IVE.dta", clear

// Tab 2
tab causal_num prevision, m matcell(A) 
mat B = J(3,1,.)
forval f = 1/3{
	mat B[`f',1] = A[`f',1]+A[`f',2]+ A[`f',3]+A[`f',4]+A[`f',5]
}
mat li B
mat C = A,B
mat colnames C = "FFAA" "FONASA" "Isapre" "Sin Previsión" "Desconocido" "Total"
mat li C
mat D = C

forval c = 1/3{
	mat D[`c',6] =D[`c',6] - A[`c',5]
	forval p = 1/6{
		mat D[`c',`p'] = D[`c',`p']/C[`c',6]*100
	}
}
mat li D 

mat E = C\D
mat E = E[1..6,1..4],E[1..6,6]
mat rownames E = "Women_at_Risk" "Fetal_Inviability" "Pregnancy_by_Rape" "Women_at_Risk" "Fetal_Inviability" "Pregnancy_by_Rape"
mat li E

*outtable using "$tab/insurance", mat(E) replace nobox center format(%3.2f %3.2f %3.2f %3.2f %3.2f)


***********************************************************************


// FIG 3
// Panel a
shp2dta using "$raw\Mapa/Regional_v2/Regional", database("$raw\Mapa/Regional_v2/regdb") coordinates("$raw\Mapa/Regional_v2/regcoord") genid(id) replace

*Variable cir_sena (region_orden) está en -1 mala desde ñuble, se arregla:
use "$raw\Mapa/Regional_v2/regdb", clear
replace cir_sena = cir_sena +1 if cir_sena >=10
replace cir_sena = 10 if codregion == 8
save "$raw\Mapa/Regional_v2/regdb", replace

*se corta la longitud para sacar Rapa Nui
use "$raw\Mapa/Regional_v2/regcoord", clear
replace _X = -10000000 if _X < -10000000
save "$raw\Mapa/Regional_v2/regcoord", replace

replace _X = -9000000 if _X < -9000000
save "$raw\Mapa/Regional_v2/regcoord_v2", replace

// Tasa de denuncias
use "$data/Denuncias.dta", clear
merge 1:1 cir_sena using "$raw\Mapa/Regional_v2/regdb"
keep if _merge == 3
drop _merge id
tempfile p
save `p'


use "$data/Population.dta", clear 
drop if year == 2021
gen codregion = floor(comuna/1000)
collapse (mean) poblacion_comuna_edfertil , by(year codregion)
reshape wide poblacion_comuna_edfertil, i(codregion) j(year)
merge 1:1 codregion using `p'

*Tasa de denuncias cada año
forval y= 2018/2020{
	gen tasa_denuncias_100mil`y' = n_denuncias`y'/poblacion_comuna_edfertil`y'*100000 
}
*Promedio de denuncias de 2018-2020
egen tasa_denuncias_100mil = rowmean(tasa_denuncias_100mil*)
format tasa_denuncias_100mil %3.0f

drop n_denuncias* poblacion_comuna_edfertil* _merge
drop tasa_denuncias_100mil2018 tasa_denuncias_100mil2019 tasa_denuncias_100mil2020

spmap tasa_denuncias using "$raw\Mapa/Regional_v2/regcoord" /*if cod_prov != 52*/, id(cir_sena) fcolor(Blues) legend(size(*2))
graph export "$graf/mapa_tasadenuncias_reg.pdf", as(pdf) replace 

spmap tasa_denuncias using "$raw\Mapa/Regional_v2/regcoord_v2" /*if cod_prov != 52*/, id(cir_sena) fcolor(Blues) legend(size(*3.4))
*graph export "$graf/mapa_tasadenuncias_reg_v2.pdf", as(pdf) replace 


// Panel b
use "$data/Population.dta", clear
drop if year == 2021
gen codregion = floor(comuna/1000)
collapse (mean) poblacion_comuna_edfertil , by(codregion)
tempfile p
save `p'

use "$data/IVE.dta", clear
keep if causal_3 == 1
drop if year == 2021
drop if codregion == .
collapse (sum) causal_3, by(codregion) //*Número de causales 3 por region

merge 1:1 codregion using `p'
gen tasa_causal3 = causal_3/poblacion_comuna_edfertil*100000 //tasa de causal 3 cada 100.000 mujeres
format tasa_causal3 %3.0f
drop causal_3 poblacion_comuna_edfertil _merge

merge 1:1 codregion using "$raw\Mapa/Regional_v2/regdb"
keep if _merge == 3

spmap tasa_causal3 using "$raw\Mapa/Regional_v2/regcoord" /*if cod_prov != 52*/, id(cir_sena) fcolor(Blues) legend(size(*2) placement(s))
graph export "$graf/mapa_tasacausal3_reg.pdf", as(pdf) replace 

spmap tasa_causal3 using "$raw\Mapa/Regional_v2/regcoord_v2" /*if cod_prov != 52*/, id(cir_sena) fcolor(Blues) legend(size(*3.4) placement(s))
*graph export "$graf/mapa_tasacausal3_reg_v2.pdf", as(pdf) replace 

***********************************************************************

// FIG 4
// Percentage of Conscentious Objectors by Request
use "$data/Conscious_Objectors.dta", clear

graph bar perc_* , over(funcionario2) /*title("Percentage of Conscious Objectors by Causal") subtitle("National Average")*/ ytitle("%") legend(order(1 "1: Woman at Risk" 2 "2: No Fetal Viability" 3 "3: Pregnancy by Rape")) /*note("Minsal: Objeción de Conciencia Individual, sept 2019")*/
*graph export "$graf/objecion_conciencia_individual.pdf", as(pdf) replace

***********************************************************************

// TAB 3

// Data
use "$data/Conscious_Objectors_Region.dta", clear

mat A = J(16,4,.)
mat rownames A = "Arica" "Iquique" "Antofagasta" "Atacama" "Coquimbo" "Valparaíso" "Metropolitana" "O'Higgins" "Maule" "Ñuble" "Biobío" "La_Araucanía" "Los_R\'ios" "Los_Lagos" "Ays\'en" "Magallanes"
mat Am = A
mat Aa = A
mat An = A
mat Ap = A
mat colnames A = "\%_Causal_1" "\%_Causal_2" "\%_Causal_3" "Total_Workers"
forval r = 1/16{
    forval c = 1/3{
	    sum porc_objetores_c`c' if region_orden == `r'
		mat A[`r',`c'] = r(mean)
	}
		sum contratados if region_orden == `r'
		mat A[`r',4] = r(mean)
}
mat li A

*Ahora, específico para cada tipo de funcionario
*Medicos
mat colnames Am = "\%_Causal_1" "\%_Causal_2" "\%_Causal_3" "Total_Doctors"
forval r = 1/16{
    forval c = 1/3{
	    qui: sum porc_medicos_c`c' if region_orden == `r'
		mat Am[`r',`c'] = r(mean)
	}
		qui: sum contratados_medicos if region_orden == `r'
		mat Am[`r',4] = r(mean)
}
*Anestecistas
mat colnames Aa = "\%_Causal_1" "\%_Causal_2" "\%_Causal_3" "Total_Anesthetists"
forval r = 1/16{
    forval c = 1/3{
	    qui: sum porc_anestecistas_c`c' if region_orden == `r'
		mat Aa[`r',`c'] = r(mean)
	}
		qui: sum contratados_anestecistas if region_orden == `r'
		mat Aa[`r',4] = r(mean)
}
*No-medicos
mat colnames An = "\%_Causal_1" "\%_Causal_2" "\%_Causal_3" "Total_Non-Doctors"
forval r = 1/16{
    forval c = 1/3{
	    qui: sum porc_no_medicos_c`c' if region_orden == `r'
		mat An[`r',`c'] = r(mean)
	}
		qui: sum contratados_no_medicos if region_orden == `r'
		mat An[`r',4] = r(mean)
}
*Paramedicos
mat colnames Ap = "\%_Causal_1" "\%_Causal_2" "\%_Causal_3" "Total_Paramedics"
forval r = 1/16{
    forval c = 1/3{
	    qui: sum porc_paramedicos_c`c' if region_orden == `r'
		mat Ap[`r',`c'] = r(mean)
	}
		qui: sum contratados_paramedicos if region_orden == `r'
		mat Ap[`r',4] = r(mean)
}

mat li Am
mat li Aa
mat li An
mat li Ap

outtable using "$tab/porc_objetores_region", mat(A) replace nobox center caption("Porcentage of Consientious Objectors by Request and Region") format(%3.2f %3.2f %3.2f %3.0f)

outtable using "$tab/porc_objetores_region_doctors", mat(Am) replace nobox center caption("Porcentage of Doctors who are Consientious Objectors by Request and Region") format(%3.2f %3.2f %3.2f %3.0f)
*outtable using "$tab/porc_objetores_region_anest", mat(Aa) replace nobox center caption("Porcentage of Anesthetists who are Consientious Objectors by Request and Region") format(%3.2f %3.2f %3.2f %3.0f)
*outtable using "$tab/porc_objetores_region_nondoctors", mat(An) replace nobox center caption("Porcentage of Non-Doctors who are Consientious Objectors by Request and Region") format(%3.2f %3.2f %3.2f %3.0f)
*outtable using "$tab/porc_objetores_region_param", mat(Ap) replace nobox center caption("Porcentage of Paramedics who are Consientious Objectors by Request and Region") format(%3.2f %3.2f %3.2f %3.0f)

